﻿using System;
using System.Web.Security;
using System.Web;
using Utilities;

public partial class master_admin : System.Web.UI.MasterPage
{
    private bool IsAdmin
    {
        get
        {
            try
            {
                if (HttpContext.Current.Request.Cookies["IsAdmin"].Value == "true")
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }
    }

    

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!CookieManager.IsAdmin)
            {
                RedirectToAdminLogin();
            }
        }
    }

    private void RedirectToAdminLogin()
    {
        Response.Redirect("~/admin-login.aspx");
    }

   
}
